package homework.day07.bean;

/**
 * @author ThinkBook
 */
public class Duration {
    private int hours;
    private int minutes;
    private int seconds;

    public Duration(int hours,int minutes,int seconds){
        this.hours = hours;
        this.minutes = minutes;
        this.seconds = seconds;
    }
    public Duration(int totalSeconds){
        this.hours = totalSeconds/3600;
        this.minutes = totalSeconds%3600/60;
        this.seconds = totalSeconds%60;
    }

    public int getHours() {
        return hours;
    }

    public int getMinutes() {
        return minutes;
    }

    public int getSeconds() {
        return seconds;
    }
    public int getTotalSeconds(){
        this.seconds = hours*3600+minutes*60+seconds;
        return this.seconds;
    }
    public String toString() {
        return hours+"时"+minutes+"分"+seconds+"秒";
    }
}
